<template>
  <el-container class="app-container">
    <el-header class="app-header">
      <el-menu
        :default-active="activePath"
        mode="horizontal"
        :ellipsis="false"
        @select="handleMenuChange"
      >
        <el-menu-item index="/home">
          <router-link to="/">Home</router-link>
        </el-menu-item>
        <el-menu-item index="/projectCenter">
          <router-link to="/projectCenter">Project Center</router-link>
        </el-menu-item>
      </el-menu>
    </el-header>
    <el-main class="app-main">
      <router-view v-slot="{ Component }">
        <keep-alive>
          <component :is="Component" />
        </keep-alive>
      </router-view>
    </el-main>
  </el-container>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { RouterView, useRoute } from 'vue-router'

const route = useRoute()
const activePath = ref(route.path)

function handleMenuChange(key: string, keyPath: string[]) {
  console.log(key, keyPath)
}
</script>

<style scoped>
.app-container {
  width: 100%;
  height: 100%;
}
.app-header {
  height: 60px;
}
.app-main {
  height: calc(100vh - 60px);
  padding: 0;
}
</style>
